/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package guitests;

import gui.incremental.JClockGuardDialogue;
import gui.incremental.JMessageDialog;
import gui.incremental.JTIOADialog;
import gui.incremental.JTransitionDialog;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import parameters.Parameters;
import parsing.ParseException;
import parsing.Parser;
import syntax.Clock;
import syntax.ClockConditionAtom;
import syntax.Domain;
import syntax.Operator;
import syntax.Repository;
import syntax.TIOA;
import syntax.Transition;
import test.MinDelayTestStrategy;
import test.TestStrategy;
import vv.Test;

/**
 *
 * @author ennouaary
 */
public class JClockGuardFrameTest {

    TIOA tioa;
    Parser parser;
    File file;
    FileReader fi;

    public JClockGuardFrameTest() {
        file = new File("C:\\Users\\ennouaary\\Documents\\NetBeansProjects\\TIOA\\examples\\tel.txt");
//        file = new File("/home/hicham/recherche/VV/TIOA/data/tel.txt");
        try {
            fi = new FileReader(file);
        } catch (FileNotFoundException ex) {
            Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
        }
        parser = new Parser(fi);
        try {
            tioa = parser.getTIOA();
            System.out.println("TIOA : " + tioa.getName());
        } catch (ParseException ex) {
            Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    
    private void testTransition() {
        ClockConditionAtom atom = new ClockConditionAtom();
        float infinity = Parameters.getInfinity();
        Clock clock = new Clock("X", new Float(0), infinity);
        atom.setClock(clock);
        atom.setLowerRelation(Operator.Op.LT);
        atom.setUpperRelation(Operator.Op.LT);
        atom.setDomain(new Domain(0, infinity));

        System.out.println("OK");

        Transition transition = Repository.getInstance().getAllTransitions().iterator().next();
        System.out.println(transition);
        //JClockGuardFrame frame = new JClockGuardDialogue(atom, transition);
        //JClockGuardFrame frame = new JClockGuardDialogue(transition);
        JTransitionDialog frame = new JTransitionDialog(transition, null, null);        
//        frame.setVisible(true);
        //JMessageFrame frame = new JMessageDialog(transition);
        frame.setVisible(true);
    
    }

    private void testTIOA() {
        JTIOADialog frame = new JTIOADialog(tioa);
        frame.setVisible(true);
    }
    
    public static void main(String args[]) {
        JClockGuardFrameTest test = new JClockGuardFrameTest();

        //test.testTransition();
        test.testTIOA();
//        try {
//            Thread.sleep(10000);
//        } catch (InterruptedException ex) {
//            Logger.getLogger(JClockGuardFrameTest.class.getName()).log(Level.SEVERE, null, ex);
//        }
//        System.out.println(transition);
//        
//        System.out.println(atom);
    }
}
